package mesh;
import static org.lwjgl.opengl.GL11.glLoadIdentity;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glTranslatef;

import org.lwjgl.util.vector.Vector3f;

public class Mesh extends MeshData {
	
	private Vector3f position = new Vector3f(0.0f,0.0f,0.0f);
	private Vector3f rotation = new Vector3f(0.0f,0.0f,0.0f);
//	private Light3D light;
//	private Texture texture;

	public Mesh(String fileName){
		
		parseData(fileName);
//		getTexture(texture);
	}
	
	public Mesh()
	{
		
	}

//	public void addLights( Light3D light)
//	{
//		this.light = light;
//	}
	
	public void setPosition(Vector3f pos)
	{
		position = pos;
		glTranslatef(position.x, position.y, position.z);
	}
	public void setRotation(float x, float y, float z, Vector3f rot) {
		
		rotation = rot;
	}

	public void draw(Player player){
		
		float finalPosX = player.position.x + position.x;
		float finalPosY = player.position.y + position.y;
		float finalPosZ = player.position.z + position.z;
		
		float finalRotX = player.rotation.x + rotation.x;
		float finalRotY = player.rotation.y + rotation.y;
		float finalRotZ = player.rotation.z + rotation.z;
		
		glLoadIdentity();
		glRotatef(finalRotX, 1, 0, 0);
		glRotatef(finalRotY, 0, 1, 0);
		glRotatef(finalRotZ, 0, 0, 1);
		glTranslatef(finalPosX, finalPosY, finalPosZ);
		
		paint();
	}
}